package com.jbm.enterapplication.moduserpwd.mode

import com.jbm.core.iface.IAcross
import com.jbm.enterapplication.InterfaceMa
import com.jbm.enterapplication.utlisclass.HttpNet
import rx.Observable
import rx.Observer

/**
 * Created by 家帮忙 on 2017/9/5.
 */
class Chang_mode_Pwd :Chang_mode_Pwd_In <String>{
    override fun setModiMiMa(Jm: String, Xm: String, Zm: String, onclicklin: InterfaceMa<String>) {
        HttpNet.getInstans().obsevice(Observable.create(Observable.OnSubscribe <IAcross>{ obmodi->
         obmodi.onNext(HttpNet.getInstans().getOhInter(). ChangePass(Xm, Jm)  )




        })).subscribe(object :Observer<IAcross>{
            override fun onCompleted() {

            }
            override fun onNext(t: IAcross?) {
                if (t?.m_code == 200) {
                    onclicklin.onSuccess("密码修改成功请退出后" + "\n" + "重新登陆",true)
                } else if (t?.m_info == "Not Connect") {
                    onclicklin.onSuccess(t?.m_info,false)
                } else if (t?.m_code == 500) {
                    onclicklin.onSuccess(t?.m_info,false)
                } else {
                    onclicklin.onSuccess(t?.m_info!!,false)
                }




            }

            override fun onError(e: Throwable?) {



            }

        })








    }

}